package csdn;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Test6 {
    public static void main(String[] args) {
        String path="D:\\javacode\\javacode\\IO_1\\read.txt";
        FileReader fileReader=null;
        int readData=0;
        try {
            fileReader = new FileReader(path);
            while((readData=fileReader.read())!=-1){
                System.out.print((char) readData);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            //关闭字符流，释放资源
            try {
                fileReader.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
